<?php

namespace Modules\Web\Http\Controllers;

use Illuminate\Http\Request;
use Modules\Web\Service\RepairOrderService;

class RepairOrderController extends BaseController
{
    /**
     * 服务商品订单列表
     * yang 2019 11 01
     */
    public function get_repair_order_list(Request $request)
    {
        $arrInput = $request->all();
        $arr_list = RepairOrderService::get_repair_order_list((array)$arrInput);
        return response_json($arr_list);
    }

    /**
     * 服务商品订单详情
     * yang 2019 11 01
     */
    public function get_repair_order_info(Request $request)
    {
        $oid = $request->get('id');
        $info = RepairOrderService::get_repair_order_info((int)$oid);
        return response_json($info);
    }

    /**
     * 订单状态处理
     * yang 2019 11 01
     */
    public function chang_repair_status(Request $request)
    {
        $arrInput = $request->all();
        $res = RepairOrderService::chang_repair_status((array)$arrInput);
        return response_json($res);
    }

    /**
     * 退款处理
     * 2019 11 01
     */
    public function refund_repair_order(Request $request)
    {
        $arrInput = $request->all();

        shiwu_start();
        $res = RepairOrderService::refund_repair_order((array)$arrInput);
        shiwu_end($res);

        return response_json($res);
    }

    /**
     * 商户端扫码确认可以完成订单
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function scanning_code(Request $request)
    {
        $arr_input = $request->all();

        $res = RepairOrderService::scanning_code($arr_input);

        return response_json($res);
    }
}